package io.lkt.modules.job.utils;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;

import java.io.IOException;

/**
 * TODO:类说明
 * <p>
 * Created by wubin.hwang on 2020/3/28.
 */
public class HttpGetPostUtils {
    public static void delCache(String serviceUrls, String mapperName) throws IOException {

        String[] urlArr = serviceUrls.split(",");
        for (String url : urlArr) {
            HttpClient httpClient = HttpClientBuilder.create().build();
            HttpGet get = new HttpGet("http://" + url + "/cache/delCache?key=com.tulele.vtool.mapper." + mapperName);
            HttpResponse response = httpClient.execute(get);
            String context = EntityUtils.toString(response.getEntity());
            System.out.println(context);
        }
    }

}
